package com.pro.service.imple;

import com.pro.mapper.JsBannerMapper;
import com.pro.pojo.JsCarousel;
import com.pro.service.JsBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author cyj
 * @date 2022.3.18$ 9.50$
 * @content :
 */
@Service
public class JsBannerServiceImple implements JsBannerService {

    /**
     * @author cyj
     * @date 2022.3.18$ 9.56$
     * @content : 获取轮播图信息
     */
    @Autowired
    private JsBannerMapper mapper;
    @Override
    public List<JsCarousel> getAllBanner(String imgType, String display, Integer limit, Integer page) {
        page = (page-1)*limit;
        List<JsCarousel> banners = mapper.getAllBanner(imgType, display,limit,page);
        return banners;
    }

    /**
     * @author cyj
     * @date 2022.3.18$ 9.59$
     * @content : 轮播图计数
     */
    @Override
    public Integer countBanners(String imgType, String display) {
        return mapper.countBanners(imgType,display);
    }
    /**
     * @author cyj
     * @date 2022.3.18$ 10.23$
     * @content : 轮播图删除
     */
    @Override
    public Boolean delBanner(Integer id) {
        return mapper.delBanner(id);
    }
    /**
     * @author cyj
     * @date 2022.3.18$ 10.35$
     * @content : 获取一个轮播图的详细信息
     */
    @Override
    public JsCarousel getOnlyBanner(Integer id) {
        return mapper.getOnlyBanner(id);
    }
    /**
     * @author cyj
     * @date 2022.3.18$ 14.44$
     * @content : 修改一个轮播图的详细信息
     */
    @Override
    public Boolean updateBanner(JsCarousel jsCarousel) {
        return mapper.updateBanner(jsCarousel);
    }
    /**
     * @author cyj
     * @date 2022.3.21$ 13.44$
     * @content : 新增一个轮播图
     */
    @Override
    public Boolean addBanner(JsCarousel jsCarousel) {
        return mapper.addBanner(jsCarousel);
    }


}
